package pw.canyingisme.plugin.occupation;


import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;
import pw.canyingisme.plugin.config.ConfigLoader;

public class OccupationHealth {
    public static void setPlayerOccupationHealth(Player player){
        setPlayerOccupationHealth(player, ConfigLoader.getPlayerOccupation(player.getName()));
    }
    public static void setPlayerOccupationHealth(Player player,String Occupation){
        if(ConfigLoader.hasOccupationHealth(Occupation)){
            setPlayerOccupationHealth(player,ConfigLoader.getOccupationHealth(Occupation));
        }return;
    }
    public static void setPlayerOccupationHealth(Player player,double health){
        player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(health);
        player.setHealthScale(20);
        player.setHealthScaled(true);
    }
    public static void removePlayerOccupationHealth(Player player){
        setPlayerOccupationHealth(player,20);
        player.setHealthScaled(false);
    }
    public static double getPlayerMaxHealth(Player player){
        return player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
    }
}
